﻿@namespace SwashbucklerDiary.Rcl.Components
@inherits CardListComponentBase<DiaryModel>

<div class="card-list-wrap">
    <div class="card-list-main @(showMenu?"card-list-menu__open":"") @(showIcon?"":"card-list-icon__none")">
        <CascadingValue Value="options"
                        IsFixed="true">
            <Virtualize Items="Value"
                        ItemSize="@ItemHeight"
                        Context="item"
                        OverscanCount="30">
                <DiaryCard @key="item.Id"
                           Value="item"
                           OnMenu="OpenMenu">
                </DiaryCard>
            </Virtualize>
        </CascadingValue>
    </div>
    @if (Value.Count > 0 && showStatisticsCard)
    {
        <MultiDisplay MdAndUp="true">
            <DesktopContent>
                <div class="card-list-assist-info">
                    <DiaryStatisticsCard Value="Value"></DiaryStatisticsCard>
                </div>
            </DesktopContent>
        </MultiDisplay>
    }
</div>

<EmptyResult Show="Value.Count == 0"
             Text="@(NotFoundText ?? I18n.T("Diary.NoDiary"))">
</EmptyResult>

<SelectTagsDialog @bind-Visible="showSelectTag"
                  @bind-Value="SelectedTags"
                  Items="Tags"
                  ItemsChanged="TagsChanged"
                  OnSave="SaveSelectTags">
</SelectTagsDialog>

<DeleteDialog @bind-Visible="showDeleteDiary"
              Title="@(I18n.T("Diary.Delete.Title"))"
              Content="@(I18n.T("Diary.Delete.Content"))"
              OnOK="ConfirmDelete">
</DeleteDialog>

<ExportDialog @bind-Visible="showExport"
              Value="exportDiaries">
</ExportDialog>

<RadioDialog @bind-Value="sortItem"
             @bind-Visible="showSort"
             OnChange="SortChanged"
             TItem="string"
             TItemValue="string"
             Title="@(I18n.T("Share.Sort"))"
             Items="SortItems">
</RadioDialog>

<MultiMenu @ref="multiMenu"
           @bind-Visible="showMenu"
           DynamicListItems="menuItems">
</MultiMenu>
